package org.wu.framework.authorization.platform.application.assembler;


import org.wu.framework.authorization.platform.application.command.SysRoleMenuCommand;
import org.wu.framework.authorization.platform.application.dto.SysRoleMenuDTO;
import org.wu.framework.authorization.platform.domain.model.sys.role.menu.SysRoleMenu;
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyAssembler;

/**
 * describe 角色菜单
 *
 * @author Jia wei Wu
 * @date 2023/05/17 11:19 晚上
 * @see DefaultDDDLazyAssembler
 **/

public class SysRoleMenuDTOAssembler {


    /**
     * describe 应用层入参转换成 持久层入参
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/
    public static SysRoleMenu toRoleMenu(SysRoleMenuCommand sysRoleMenuCommand) {
        if (null != sysRoleMenuCommand) {
            SysRoleMenu sysRoleMenu = new SysRoleMenu();
            sysRoleMenu.setCreateTime(sysRoleMenuCommand.getCreateTime());
            sysRoleMenu.setId(sysRoleMenuCommand.getId());
            sysRoleMenu.setIsDeleted(sysRoleMenuCommand.getIsDeleted());
            sysRoleMenu.setMenuId(sysRoleMenuCommand.getMenuId());
            sysRoleMenu.setRoleId(sysRoleMenuCommand.getRoleId());
            sysRoleMenu.setUpdateTime(sysRoleMenuCommand.getUpdateTime());
            return sysRoleMenu;
        }
        return null;
    }

    /**
     * describe 持久层领域对象转换成DTO对象
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/
    public static SysRoleMenuDTO fromRoleMenu(SysRoleMenu sysRoleMenu) {
        if (null != sysRoleMenu) {
            SysRoleMenuDTO sysRoleMenuDTO = new SysRoleMenuDTO();
            sysRoleMenuDTO.setCreateTime(sysRoleMenu.getCreateTime());
            sysRoleMenuDTO.setId(sysRoleMenu.getId());
            sysRoleMenuDTO.setIsDeleted(sysRoleMenu.getIsDeleted());
            sysRoleMenuDTO.setMenuId(sysRoleMenu.getMenuId());
            sysRoleMenuDTO.setRoleId(sysRoleMenu.getRoleId());
            sysRoleMenuDTO.setUpdateTime(sysRoleMenu.getUpdateTime());
            return sysRoleMenuDTO;
        }
        return null;
    }

}